<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/ajax/libs/jquery-layout/jquery.layout-latest.css}" rel="stylesheet"/>
<link th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>

<body class="gray-bg">
<div class="ui-layout-west">
    <div class="main-content">
        <div class="box box-main" style="width: 3000px">
            <div class="box-header">
                <div class="box-title">
                    <i class="fa icon-grid"></i> 终端列表
                </div>
                <div class="box-tools pull-right">
                    <button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;">
                        <i class="fa fa-chevron-up"></i></button>
                    <button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠">
                        <i class="fa fa-chevron-down"></i></button>
                    <button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新">
                        <i class="fa fa-refresh"></i></button>
                </div>
            </div>
            <div class="ui-layout-content">
                <div id="tree" class="ztree" style="overflow: auto"></div>
            </div>
        </div>
    </div>
</div>

<div class="container-div ui-layout-center">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            授权号码：<input type="text" name="phone" style="width: 240px"/>
                        </li>

                        <li>
                            用户编号：<input type="text" name="uid" style="width: 238px"/>
                        </li>

                        <li>
                            用户姓名：<input type="text" name="uname" style="width: 240px"/>
                        </li>

                        <li>
                            权限编码：<input type="text" name="rolecode" style="width: 240px"/>
                        </li>

                        <li>
                            批准人编号：<input type="text" name="allowid" style="width: 225px"/>
                        </li>

                        <li>
                            批准人姓名：<input type="text" name="allowname" style="width: 230px"/>
                        </li>

                        <li>
                            再次批准人编号：<input type="text" name="reallowid"/>
                        </li>

                        <li>
                            再次批准人姓名：<input type="text" name="reallowname"/>
                        </li>

                        <li>
                            批准人证明：<input type="text" name="allowpic" style="width: 230px"/>
                        </li>

                        <li>
                            <!--                            <div class="form-group">-->
                            <!--                            <label class="col-sm-3 control-label"></label>-->
                            <div class="col-sm-8">
                                <div class="input-group date">
                                    <span class="input-group-addon"><i class="fa fa-calendar"></i> </span>
                                    首次批准时间：<input name="allowdate" class="time-input" placeholder="" type="text">
                                </div>
                            </div>
                            <!--                            </div>-->
                        </li>

                        <!--                        <li>-->
                        <!--                            备注：<input type="text" name="demo"/>-->
                        <!--                        </li>-->

                        <!--                        <li>-->
                        <!--                            0-无效,1-有效：<input type="text" name="remark"/>-->
                        <!--                        </li>-->

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="btn-group-sm hidden-xs" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()"
               shiro:hasPermission="broad:terminaladmin:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()"
               shiro:hasPermission="broad:terminaladmin:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="broad:terminaladmin:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()"
               shiro:hasPermission="broad:terminaladmin:export">
                <i class="fa fa-download"></i> 导出
            </a>
            <a class="btn btn-warning" onclick="$.table.importExcel()"
               shiro:hasPermission="broad:terminaladmin:import">
                <i class="fa fa-download"></i> 导入
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:src="@{/ajax/libs/jquery-layout/jquery.layout-latest.js}"></script>
<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('broad:terminaladmin:edit')}]];
    var removeFlag = [[${@permission.hasPermi('broad:terminaladmin:remove')}]];
    var prefix = ctx + "broad/terminaladmin";
    $(function() {
        $('body').layout({ west__size: 185 });
        queryAreaList();
        queryAreaTree();
    });

    function queryAreaList() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "授权号码管理",
            search: false,
            showExport: true,
            columns: [{
                checkbox: true
            },
                {
                    field: 'pid',
                    title: '编号',
                    visible: false
                },
                {
                    field: 'phone',
                    title: '授权号码',
                    sortable: true
                },
                {
                    field: 'uid',
                    title: '用户编号',
                    sortable: true
                },
                {
                    field: 'uname',
                    title: '用户姓名',
                    sortable: true
                },
                {
                    field: 'rolecode',
                    title: '权限编码',
                    sortable: true
                },
                {
                    field: 'allowid',
                    title: '批准人编号',
                    sortable: true
                },
                {
                    field: 'allowname',
                    title: '批准人姓名',
                    sortable: true
                },
                {
                    field: 'allowdate',
                    title: '首次批准时间',
                    sortable: true
                },
                {
                    field: 'reallowid',
                    title: '再次批准人编号',
                    sortable: true
                },
                {
                    field: 'reallowname',
                    title: '再次批准人姓名',
                    sortable: true
                },
                {
                    field: 'allowpic',
                    title: '批准人证明',
                    sortable: true
                },
                {
                    field: 'demo',
                    title: '备注',
                    sortable: true
                },
                {
                    field: 'remark',
                    title: '0-无效,1-有效',
                    sortable: true
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.pid + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.pid + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    }
    function queryAreaTree(){
        var url = ctx + "system/dept/treeData";
        var options = {
            url: url,
            onClick : zOnClick
        };
        $.tree.init(options);

        function zOnClick(event, treeId, treeNode) {
            aid1 = treeNode.id;
            $("#aid").val(treeNode.id);
            $.table.search();
        }
        $.tree.init(options);
    }
</script>
</body>
</html>